package com.mulanweb.utils;

/**
 * Created by Administrator on 2016/10/8.
 */
public class RandomUtil {

    public static String createRandomOrderNumber(){
        int r1=(int)(Math.random()*(10));//产生2个0-9的随机数
        int r2=(int)(Math.random()*(10));
        int r3=(int)(Math.random()*(10));//产生2个0-9的随机数
        int r4=(int)(Math.random()*(10));
        long now = System.currentTimeMillis();//一个13位的时间戳
        String orderId ="XXL"+String.valueOf(r1)+String.valueOf(r2)+String.valueOf(now+r3)+String.valueOf(r4+r3+r2+r1);// 订单ID
        return orderId;
    }

    public static String createRandomNumber(int numberLength){
        String value = "";
        for(int i = 0 ; i<numberLength; i++){
            value = value+(int)(Math.random()*(10));
        }
        return value ;
    }
}
